package com.aabte.hystrixlearn.hystrix.command;

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;

/**
 * @author Daniel
 */
public class FlushCacheDemoCommand extends HystrixCommand<String> {

    private final String code;

    protected FlushCacheDemoCommand(String code) {
        super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("FlushCacheDemoCommandGroup")));
        this.code = code;
    }

    @Override
    protected String run() throws Exception {
        // 接口调用，更新操作之后手动清理缓存
        CacheCommand.flushCache(code);
        return "";
    }
}
